import Taro, { Component } from '@tarojs/taro';
import { View, Text, Button, Video } from '@tarojs/components';
import NavigationBar from '../../../components/navigationBar/index';
import './index.scss';
import { getvideolist } from '../../../services/user';

export default class Index extends Component {

  config = {
    navigationBarTitleText: ''
  }

  state = {
    video_url: '',
    video_title: ''
  }

  componentWillMount() {
    getvideolist({
      id: this.$router.params.video_id,
    }).then(data => {
      this.setState({
        video_url:data.url,
        video_title:data.title
      })
    }
    );
  }
  componentDidMount() { }
  componentWillReceiveProps(nextProps, nextContext) { }
  componentWillUnmount() { }
  componentDidShow() { }
  componentDidHide() { }
  componentDidCatchError() { }
  componentDidNotFound() { }
  render() {
    const { video_url,video_title } = this.state
    return (
      <View className="used-card-record">
        <NavigationBar text={video_title} type="bindcard" />
        <Video
          style="width:100%"
          src={video_url}
          controls={true}
          id='video'
          autoplay='true'
          enablePlayGesture
        /></View>
    );
  }
}
